import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/blog'
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/Login')
  },
  {
    path: '/blog',
    name: 'blog',
    component: () => import('../views/Blog')
  },
  {
    path: '/blog/:blogId',
    name: 'BlogDetail',
    component: () => import('../views/BlogDetail')
  },
  {
    path: '/register',
    name: 'Register',
    component: () => import('../views/Register')
  },
  {
    path: '/blog/:blogId/edit',
    name: 'BlogEdit',
    component: () => import('../views/BlogEdit')
  },
  {
    path: '/add',
    name: 'blogAdd',
    component: () => import('../views/BlogEdit')
  },
  {
    path: '/test',
    name: 'test',
    component: () => import('../views/Testttt')
  },
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
